<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>广东省传播平台-刊例录入页</title>
		<link rel="stylesheet" type="text/css" href="<%=path%>/css/common.css" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/css/tag.css" />
		<script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.js"></script>
		<script type="text/javascript">
				function doSubmit(url){
				document.forms[0].action=url;
				document.forms[0].submit();
			}
		function delMedia(priceID,mediaID){
		if(confirm('确定删除该条记录？')){
			$.ajax({
		        url: "delMediaByIdAction.action?"+new Date()+"&priceID="+priceID+"&mediaID="+mediaID,
		        type:"POST",
		        cache:false,
		        success: function(message)
		        {
			    	if(message == "success")
			    	{
		        		alert("该条记录删除成功！");
		        		//ajaxLoad('main_right','getLablesListByPage.action?tagType=all');
		        		window.location.href="mediaPriceAction.action";
		        	}
		        	if(message == "error"){
			    		alert("刊例正在使用，删除失败 ！");
		        	}
		   		}
	     	});
		}
	}
	</script>
	</head>
<body>
<script type="text/javascript">
	$(function(){
        //selectNav('nav2');
    });
</script>
<!-- 顶栏start -->
<jsp:include page="../common/top.jsp"></jsp:include>
<!-- 顶部end -->

<!-- 顶部start -->
<div id="main">

	<div class="body">
	<jsp:include page="../common/nav.jsp"></jsp:include>
		<!-- 主体 -->
		<div class="main_body">
			<form action="mediumAction.action" id="form1" method="post">
			<table class="condition" style="width:100%; font-size:14px; font-weight:bold; color:#000000;" align="center">
				<tr>
					<td>
						<input type="button" class="btn-title" value="新增" onclick="doSubmit('toAddMediaPriceAction.action');" />
						<c:if test="${logUser.usercity eq mediaPrice.city}">
						&nbsp;&nbsp;&nbsp;
							<input type="button" class="btn-title" value="编辑" onclick="doSubmit('toUpdateMediaAction.action?priceID=${mediaPrice.priceID}');" />
							&nbsp;&nbsp;&nbsp;
							<input type="button" class="btn-title" value="删除" onclick="delMedia(${mediaPrice.priceID},'${mediaPrice.mediaID}');"/>
							&nbsp;&nbsp;&nbsp;
						</c:if>
						<input type="button" class="btn-title" value="返回" onclick="javascript:history.go(-1);"/>
						<!-- 
						<input type="button" class="btn-title" value="返回" onclick="doSubmit('mediaPriceAction.action?currentPage=1');"/>
						 -->
					</td>
				</tr>
			</table>
			
			<div id="list_div">
				<table class="table_list" width="100%" style="border-right-style: solid;border-right-width: 1px;">
					<tr class="bg" style="border-left: 2px solid #f37c20;">
						<th colspan="13" style="font-size:15px; padding-left:18px;">媒体信息</th>
					</tr>
					<tr>
						<th style="background:#f2f2f2;width:150px;">媒体名称</th>
						<td style="border-style:solid dashed dashed;width:250px;">${mediaPrice.mediasumm.mediaName}</td>
						<th style="background:#f2f2f2;width:150px;">媒体类型</th>
						<td style="border-style:solid dashed dashed;width:250px;" align="center">
							<s:iterator id="mtl" value="mediaTypeList">
								<s:if test="#mtl.id == mediaPrice.mediasumm.mediaType">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
						<th style="background:#f2f2f2;width:150px;">媒体折扣类型</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<s:iterator id="mtl" value="mediaDiscountTypeList">
								<s:if test="#mtl.id == mediaPrice.mediaDiscountType">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
					</tr>
					<tr>
						<th style="background:#f2f2f2;width:150px;">合同编号</th>
						<td style="border-style:solid dashed dashed;width:250px;">
							${mediaPrice.contractID}
						</td>
						<th style="background:#f2f2f2;width:150px;">合同名称</th>
						<td style="border-style:solid dashed dashed;width:250px;">
							${mediaPrice.contract.contractName}
						</td>
						<th style="background:#f2f2f2;width:150px;">归属地市</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<s:iterator id="mtl" value="citylist">
								<s:if test="#mtl.id == mediaPrice.city">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
					</tr>
					
					<tr>
						<th style="background:#f2f2f2;width:150px;">代理商</th>
						<td style="border-style:solid dashed dashed;">
							<c:if test="${empty mediaPrice.mediaAgent}">
								无
							</c:if>
							<c:if test="${!empty mediaPrice.mediaAgent}">
								${mediaPrice.mediaAgent}
							</c:if>
						</td>
						<th style="background:#f2f2f2;width:150px;">供应商</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<c:if test="${empty mediaPrice.mediasumm.mediaProvider}">
								无
							</c:if>
							<c:if test="${!empty mediaPrice.mediasumm.mediaProvider}">
								${mediaPrice.mediasumm.mediaProvider}
							</c:if>
						</td>
						<th style="background:#f2f2f2;width:150px;">签约年份</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							${mediaPrice.contractYear}
						</td>
					</tr>
					
					
					<tr>
						<th style="background:#f2f2f2;width:150px;">开始时间</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							${fn:substring(mediaPrice.mediaStartTime,0,10)}
						</td>
						<th style="background:#f2f2f2;width:150px;">截止时间</th>
						<td style="border-style:solid dashed dashed;">
							${fn:substring(mediaPrice.mediaEndTime,0,10)}
						</td>
						<th style="background:#f2f2f2;width:150px;">使用总金额</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<fmt:formatNumber value="${mediaPrice.totalPay}" />
						</td>
					</tr>
					
					<tr>
						<th style="background:#f2f2f2;width:150px;">媒体归属</th>
						<td style="border-style:solid dashed dashed;">
							<s:iterator id="mtl" value="mediaBelogList">
								<s:if test="#mtl.id == mediaPrice.mediaBelog">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
						<th style="background:#f2f2f2;width:150px;">付款方式</th>
						<td style="border-style:solid dashed dashed;">
							<s:iterator id="mtl" value="payModeList">
											<s:if test="#mtl.id == mediaPrice.contract.contractPayment">
											${mtl.datavalue}
											</s:if>
										</s:iterator>
						</td>
						<th style="background:#f2f2f2;width:150px;">媒体资源类型</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<s:iterator id="mtl" value="mediaResourceTypeList">
								<s:if test="#mtl.id == mediaPrice.mediaResourceType">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
					</tr>
					
					<tr>
						<th style="background:#f2f2f2;width:150px;">随单赠送类型</th>
						<td style="border-style:solid dashed dashed;width:250px;">
							<s:iterator id="mtl" value="promotionATypeList">
								<s:if test="#mtl.id == mediaPrice.promotionAType">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
						<th style="background:#f2f2f2;width:150px;">常规赠送类型</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<s:iterator id="mtl" value="promotionATypeList">
								<s:if test="#mtl.id == mediaPrice.promotionBType">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
						<th style="background:#f2f2f2;width:150px;">返还赠送类型</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<s:iterator id="mtl" value="promotionATypeList">
								<s:if test="#mtl.id == mediaPrice.promotionCType">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
					</tr>
					
					<tr>
						<th style="background:#f2f2f2;width:150px;">随单赠送时间是否可调</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<c:if test="${mediaPrice.promotionAValidDateAdjustable eq 1}">
								是
							</c:if>
							<c:if test="${mediaPrice.promotionAValidDateAdjustable ne 1}">
								否
							</c:if>
						</td>
						<th style="background:#f2f2f2;width:150px;">常规赠送时间是否可调</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<c:if test="${mediaPrice.promotionBValidDateAdjustable eq 1}">
								是
							</c:if>
							<c:if test="${mediaPrice.promotionBValidDateAdjustable ne 1}">
								否
							</c:if>
						</td>
						<th style="background:#f2f2f2;width:150px;">返还赠送时间是否可调</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<c:if test="${mediaPrice.promotionCValidDateAdjustable eq 1}">
								是
							</c:if>
							<c:if test="${mediaPrice.promotionCValidDateAdjustable ne 1}">
								否
							</c:if>
						</td>
					</tr>
					<!--  
					<tr>
						<th style="background:#f2f2f2;width:150px;">随单赠送有效时间</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							${fn:substring(mediaPrice.promotionALastValidDate,0,10)}
						</td>
						<th style="background:#f2f2f2;width:150px;">常规赠送有效时间</th>
						<td style="border-style:solid dashed dashed;">
							${fn:substring(mediaPrice.promotionBLastValidDate,0,10)}
						</td>
						<th style="background:#f2f2f2;width:150px;">返还赠送有效时间</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							${fn:substring(mediaPrice.promotionCLastValidDate,0,10)}
						</td>
					</tr>
					-->
					<tr>
						<th style="background:#f2f2f2;width:150px;">随单赠送是否累计</th>
						<td style="border-style:solid;width:250px;">
							<c:if test="${mediaPrice.promotionAAccumulat eq 1}">
								是
							</c:if>
							<c:if test="${mediaPrice.promotionAAccumulat ne 1}">
								否
							</c:if>
						</td>
						<th style="background:#f2f2f2;width:150px;">常规赠送是否累计</th>
						<td style="border-style:solid;">
							<c:if test="${mediaPrice.promotionBAccumulate eq 1}">
								是
							</c:if>
							<c:if test="${mediaPrice.promotionBAccumulate ne 1}">
								否
							</c:if>
						</td>
						<th style="background:#f2f2f2;width:150px;">媒体统购类型</th>
						<td style="border-style:solid;">
							<s:iterator id="mtl" value="mediaPurchaseTypeList">
								<s:if test="#mtl.id == mediaPrice.mediaPurchaseType">
									${mtl.datavalue}
								</s:if>
							</s:iterator>
						</td>
						<!-- 
						<th style="background:#f2f2f2;width:150px;">返还赠送是否累计</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							<c:if test="${mediaPrice.promotionCLevel eq 1}">
								是
							</c:if>
							<c:if test="${mediaPrice.promotionCLevel ne 1}">
								否
							</c:if>
						</td>
						 -->
					</tr>
						<!-- 
						<tr>
						<th style="background:#f2f2f2;width:150px;"></th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							
						</td>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;" colspan="4">
							&nbsp;
						</td>
						
						<th style="background:#f2f2f2;width:150px;">计算周期</th>
						<td style="border-style:solid dashed dashed;">
							${mediaPrice.levelCalculatePeriod}
						</td>
						<th style="background:#f2f2f2;width:150px;">当前阶梯计算日</th>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;">
							${fn:substring(mediaPrice.lastCalculateDate,0,10)}
						</td>
					</tr>
						 -->
					
					<tr>
						<th style="background:#f2f2f2;width:150px;">媒体简介</th>
						<td style="border-style:solid dashed dashed;border-right-style:solid;text-align: left" colspan="5">
							&nbsp;&nbsp;${mediaPrice.mediasumm.mediaDescription}
						</td>
					</tr>
					
					<tr>
						<td style="border-style:solid dashed dashed;border-right-style: solid;border-right-width:1px;border-left-style: solid;" colspan="6">
							&nbsp;
						</td>
					</tr>
					<tr class="bg" style="border-left: 2px solid #f37c20;text-align: left;">
						<th colspan="13" style="background:#f2f2f2;font-size:15px; padding-left:18px;text-align:left;">
							<a href="javascript:doSubmit('mediumAction.action?priceID=${mediaPrice.priceID}&&mediaID=${mediaPrice.mediaID}&contractYear=${mediaPrice.contractYear}&mediaType1=${mediaPrice.mediasumm.mediaType}');" class="underline">刊例信息查看</a>
						</th>
					</tr>
					<tr>
						<td colspan="13">&nbsp;</td>
					</tr>
					<s:if test="suiDanList != null && suiDanList.size()!=0">
						<tr class="bg" style="border-left: 2px solid #f37c20;">
							<th colspan="16" style="font-size:15px;">随单赠送</th>
						</tr>
					<s:iterator value="suiDanList" id="s" status="i">
						<tr>
							<td style="border-style:dashed dashed dashed solid; text-align:left;border-right-style: solid;border-right-width:1px;" colspan="7">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第${i.index+1}档：年投放量&nbsp;&nbsp;<fmt:formatNumber value="${s.levelLowerLimit/10000}" pattern="0"/>&nbsp;-&nbsp;<fmt:formatNumber value="${s.levelUpperLimit_01/10000}" pattern="0"/>&nbsp;
								万(包含)，优惠额度&nbsp;
								<s:if test="#s.levelPromotionType ==1">
									<fmt:formatNumber value="${s.levelDiscount}" pattern='#.###'/>%。
								</s:if>
								<s:if test="#s.levelPromotionType ==2">
									<fmt:formatNumber value="${s.levelDiscount}" pattern='#.###'/>元。
								</s:if>
							</td>
						</tr>
					</s:iterator>
					</s:if>
					<s:if test="changGuiList != null && changGuiList.size()!=0">
					<tr class="bg" style="border-left: 2px solid #f37c20;">
						<th colspan="16" style="font-size:15px;">常规赠送</th>
					</tr>
					<s:iterator value="changGuiList" id="s" status="i">
						<tr>
							<td style="border-style:dashed dashed dashed solid; text-align:left;border-right-style: solid;border-right-width:1px;" colspan="7">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第${i.index+1}档：年投放量&nbsp;&nbsp;<fmt:formatNumber value="${s.levelLowerLimit/10000}" />&nbsp;-&nbsp;<fmt:formatNumber value="${s.levelUpperLimit_01/10000}" pattern="0"/>&nbsp;
								万(包含)，优惠额度&nbsp;
								<s:if test="#s.levelPromotionType ==1">
									<fmt:formatNumber value="${s.levelDiscount}" pattern='#.###'/>%。
								</s:if>
								<s:if test="#s.levelPromotionType ==2">
									<fmt:formatNumber value="${s.levelDiscount}" pattern='#.###'/>元。
								</s:if>
							</td>
						</tr>
					</s:iterator>
					</s:if>
					
					<c:if test="${eDuValue ne 0}">
					<tr class="bg" style="border-left: 2px solid #f37c20;">
						<th colspan="16" style="font-size:15px;">返还赠送</th>
					</tr>
					<s:if test="levelID == 0">
						<tr>
							<td style="border-style:dashed dashed dashed solid; text-align:left;border-right-style: solid;border-right-width:1px;" colspan="7">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返还折扣：<fmt:formatNumber value="${eDuValue}" pattern='#.###'/>%。
							</td>
						</tr>
					</s:if>
					<s:else>
					<s:iterator value="fanHuaiList" id="s" status="i">
						<tr>
							<td style="border-style:dashed dashed dashed solid; text-align:left;border-right-style: solid;border-right-width:1px;" colspan="7">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第${i.index+1}档：年投放量&nbsp;&nbsp;<fmt:formatNumber value="${s.levelLowerLimit/10000}" pattern="0"/>&nbsp;-&nbsp;<fmt:formatNumber value="${s.levelUpperLimit_01/10000}" pattern="0"/>&nbsp;
								万(包含)，优惠额度&nbsp;<fmt:formatNumber value="${s.levelDiscount}" pattern='#.###'/>%&nbsp;。
							</td>
						</tr>
					</s:iterator>
					</s:else>
					</c:if>
					<tr class="bg" style="border-left: 2px solid #f37c20;">
						<th colspan="16" style="font-size:15px;">变更记录</th>
					</tr>
					<tr style="text-align:left;">
						<td colspan="16">
							<ul>
							<s:iterator value="logList" id="list">
								<li style="height:30px; line-height:30px;">&nbsp;&nbsp;&nbsp;&nbsp;${list.content}。</li>
							</s:iterator>
							</ul>
						</td>
					</tr>
				  </table>
				</div>
			</div>
		</div>
		</form>
	</div>
	
<!-- 顶部end -->


<!-- 底部start -->
<div id="bottom">
	<div class="body">
		<label>版权所有&nbsp;&nbsp;&nbsp;&nbsp;2012东莞移动</label>
	</div>
</div>
<!-- 底部end -->
</body>
</html>
